
import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter);
const routes = [   
	{
		path:'/',
		redirect:'index'
	},
	{
		path: '/index',
		name: 'index',
		component: () => import('../views/index/index'),
		meta: {
			title: '首页',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/list',
		name: 'list',
		component: () => import('../views/list/list'),
		meta: {
			title: '',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/serTopics',
		name: 'serTopics',
		component: () => import('../views/series/serTopics'),
		meta: {
			title: '套系专题',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/serIntroduce',
		name: 'serIntroduce',
		component: () => import('../views/series/serIntroduce'),
		meta: {
			title: '套系简介',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/serDesc',
		name: 'serDesc',
		component: () => import('../views/series/serDesc'),
		meta: {
			title: '套系内图书详情',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/pubDetails',
		name: 'pubDetails',
		component: () => import('../views/details/pubDetails'),
		meta: {
			title: '',
			requireAuth: true,
			selectEdit: false,
		}
	},
	{
		path: '/profile',
		component: () => import('../views/profile/reviewContainer/review'),
		name: 'review',
		meta: {
			title: 'review',
			requireAuth: true,
			selectEdit: false,
			keepAlive: true,
		},
		redirect: '/profile/profile',
		children: [
			{
				path: '/profile',
				component: () => import('../views/profile/profile'),
				name: 'profile',
				meta: {
					title: '个人信息',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/collection',
				component: () => import('../views/profile/collection'),
				name: 'collection',
				meta: {
					title: '我的收藏',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/note',
				component: () => import('../views/profile/note'),
				name: 'note',
				meta: {
					title: '我的笔记',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/history',
				component: () => import('../views/profile/history'),
				name: 'history',
				meta: {
					title: '阅读历史',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/bookMark',
				component: () => import('../views/profile/bookMark'),
				name: 'bookMark',
				meta: {
					title: '我的书签',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/record',
				component: () => import('../views/profile/record'),
				name: 'record',
				meta: {
					title: '购买记录',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/invoice',
				component: () => import('../views/profile/invoice'),
				name: 'invoice',
				meta: {
					title: '我的发票',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			{
				path: '/profile/apply',
				component: () => import('../views/profile/apply'),
				name: 'apply',
				meta: {
					title: '机构用户申请',
					requireAuth: true,
					selectEdit: false,
					keepAlive: true,
				}
			},
			
		]
	}
	
];

//路由重复,捕获异常
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
};
const router = new VueRouter({
	// mode: "history",
	base: process.env.BASE_URL,
	routes
});

export default router;